package edu.auctionmart

import edu.auctionmart.User;
import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(User)
class UserTests {

    void testValidation() {
		
       User userAccount = new User(username: "Russell", userRealName: "administrator", passwd: "Testinga4b", email: "russell@maine.edu")
	   userAccount.validate()
	   assert(userAccount.hasErrors() == false)
	   
	   userAccount = new User(username:"Will Succeed4", userRealName: "administrator", passwd: "1234a5678B90", email: "russell@maine.edu")
	   userAccount.validate()
	   assert(userAccount.hasErrors() == false)
	   
	   userAccount = new User(username:"Will Fail", passwd: "1234a5678b90", email: "russell@maine.edu")
	   userAccount.validate()
	   assert(userAccount.hasErrors() == true)
	   	   	   	   
	   userAccount = new User(username:"ab", userRealName: "administrator", passwd: "Testinga4b", email: "russell@maine.edu")
	   userAccount.validate()
	   assert(userAccount.hasErrors() == true)
	   
    }
}
